package ch5.ext;

public class Qiangzhuan {

	public static void main(String[] args) {
		Pet p0 = new GoldFish("小红", 89, 91, "金龙鱼");

		p0.shout();
		p0.run();

		GoldFish g = (GoldFish) p0;
		g.swim();
		System.out.println(">>>>>>>>>>>>>>>>>>>");
		// Pet p1 = new Dog("小五花", 66, 77, "土狗");
		Pet p1 = new GoldFish("小五花", 66, 77, "鲤鱼");
		if (p1 instanceof GoldFish) {
			GoldFish g2 = (GoldFish) p1;
			g2.swim();
		} else {
			System.out.println("他不是金鱼");
		}

	}

}
